log using "C:\Users\User\Downloads\2019-09-12.smcl"
use "C:\Users\User\Downloads\ForISQ.dta", clear
*/Let's work with pooled data 1 - IADB and ASDB/*
keep if unsc_region==2 | unsc_region==5
*/Model 1 - Only key variables: RDB Funding, CINC, and Interaction Term, with year and country fixed-effects/*
xtset ccode year
sum commitmentsRDB commitmentwb fdi
*/We first place all values in the same scale: million USD current values/*
replace fdi=fdi/1000
replace commitmentwb=commitmentwb/1000
replace commitmentsRDB=commitmentsRDB/1000
replace commitmentwb=commitmentwb/1000000
replace commitmentsRDB=commitmentsRDB/1000000
sum commitmentsRDB commitmentwb fdi
tobit usvote l1.commitmentsRDB l1.commitmentwb l2.cincofcountry c.l1.commitmentsRDB#c.l2.cincofcountry c.l1.commitmentwb#c.l2.cincofcountry i.year i.ccode, ul(1.0001) ll(-0.0001)
tobit usvote l1.commitmentsRDB l1.commitmentwb l2.cincofcountry c.l1.commitmentsRDB#c.l2.cincofcountry c.l1.commitmentwb#c.l2.cincofcountry l1.inverse_sum l1.openness l1.nucsecguarUS i.year i.ccode, ul(1.0001) ll(-0.0001)
*/Finish Model1 - Baseline - and Model 2 - With Controls - For IADB and ASDB/*
clear
*/Let's work with pooled data 2 - IADB and ASDB and AFDB - after 1983/*
use "C:\Users\User\Downloads\ForISQ.dta", clear
keep if year>=1983
drop if unsc_region==3
replace fdi=fdi/1000
replace commitmentwb=commitmentwb/1000
replace commitmentsRDB=commitmentsRDB/1000
replace commitmentwb=commitmentwb/1000000
replace commitmentsRDB=commitmentsRDB/1000000
sum commitmentsRDB commitmentwb fdi
drop if unsc_region==.
*/Model 5 - Only key variables: RDB Funding, CINC, and Interaction Term, with year and country fixed-effects/*
xtset ccode year
tobit usvote l1.commitmentsRDB l1.commitmentwb l2.cincofcountry c.l1.commitmentsRDB#c.l2.cincofcountry c.l1.commitmentwb#c.l2.cincofcountry i.year i.ccode, ul(1.0001) ll(-0.0001)
*/Model 6/*
tobit usvote l1.commitmentsRDB l1.commitmentwb l2.cincofcountry c.l1.commitmentsRDB#c.l2.cincofcountry c.l1.commitmentwb#c.l2.cincofcountry l1.fdi l1.inverse_sum l1.openness l1.nucsecguarUS i.year i.ccode, ul(1.0001) ll(-0.0001)
clear
use "C:\Users\User\Downloads\ForISQ.dta", clear
*/Let's work with pooled data 3 - IADB and ASDB and AFDB and EBRD - after 1991/*
keep if year>=1991
replace fdi=fdi/1000
replace commitmentwb=commitmentwb/1000
replace commitmentsRDB=commitmentsRDB/1000
replace commitmentwb=commitmentwb/1000000
replace commitmentsRDB=commitmentsRDB/1000000
sum commitmentsRDB commitmentwb fdi
sum commitmentebrd
replace commitmentebrd=commitmentebrd/1000000000
sum commitmentebrd
*/Models 9 and 10 run below/*
xtset ccode year
tobit usvote l1.commitmentsRDB l1.commitmentebrd l1.commitmentwb l2.cincofcountry c.l1.commitmentsRDB#c.l2.cincofcountry c.l1.commitmentebrd#c.l2.cincofcountry c.l1.commitmentwb#c.l2.cincofcountry i.year i.ccode, ul(1.0001) ll(-0.0001)
tobit usvote l1.commitmentsRDB l1.commitmentebrd l1.commitmentwb l2.cincofcountry c.l1.commitmentsRDB#c.l2.cincofcountry c.l1.commitmentebrd#c.l2.cincofcountry c.l1.commitmentwb#c.l2.cincofcountry l1.fdi l1.inverse_sum l1.openness l1.nucsecguarUS i.year i.ccode, ul(1.0001) ll(-0.0001)
*/We now run models on membership/*
clear
use "I:\ForISQ.dta", clear
*/Let's work with pooled data 1 - IADB and ASDB/*
keep if unsc_region==2 | unsc_region==5
*/Model 3 - Only key variables: RDB Funding, CINC, and Interaction Term, with year and country fixed-effects/*
xtset ccode year
sum commitmentsRDB commitmentwb fdi
*/We first place all values in the same scale: million USD current values/*
replace fdi=fdi/1000
replace commitmentwb=commitmentwb/1000
replace commitmentsRDB=commitmentsRDB/1000
replace commitmentwb=commitmentwb/1000000
replace commitmentsRDB=commitmentsRDB/1000000
sum commitmentsRDB commitmentwb fdi
tobit usvote l1.rdbnew l1.ibrd l2.cincofcountry c.l1.rdbnew#c.l2.cincofcountry c.l1.ibrd#c.l2.cincofcountry i.year i.ccode, ul(1.0001) ll(-0.0001)
*/Model 4/*
tobit usvote l1.rdbnew l1.ibrd l2.cincofcountry c.l1.rdbnew#c.l2.cincofcountry c.l1.ibrd#c.l2.cincofcountry l1.inverse_sum l1.openness l1.nucsecguarUS i.year i.ccode, ul(1.0001) ll(-0.0001)
*/We have just finished models 3 and 4, reported in table 2/*
clear
use "C:\Users\User\Downloads\ForISQ.dta", clear
*/Let's work with pooled data 2 - IADB and ASDB and AFDB - after 1983/*
keep if year>=1983
drop if unsc_region==3
replace fdi=fdi/1000
replace commitmentwb=commitmentwb/1000
replace commitmentsRDB=commitmentsRDB/1000
replace commitmentwb=commitmentwb/1000000
replace commitmentsRDB=commitmentsRDB/1000000
sum commitmentsRDB commitmentwb fdi
drop if unsc_region==.
*/Model 7 - Only key variables: RDB Funding, CINC, and Interaction Term, with year and country fixed-effects/*
xtset ccode year
tobit usvote l1.rdbnew l1.ibrd l2.cincofcountry c.l1.rdbnew#c.l2.cincofcountry c.l1.ibrd#c.l2.cincofcountry i.year i.ccode, ul(1.0001) ll(-0.0001)
*/Model 8 has been run above with the full specification/*
tobit usvote l1.rdbnew l1.ibrd l2.cincofcountry c.l1.rdbnew#c.l2.cincofcountry c.l1.ibrd#c.l2.cincofcountry l1.fdi l1.inverse_sum l1.openness l1.nucsecguarUS i.year i.ccode, ul(1.0001) ll(-0.0001) 
clear
use "C:\Users\User\Downloads\ForISQ.dta", clear
*/Let's work with pooled data 3 - IADB and ASDB and AFDB and EBRD - after 1991/*
keep if year>=1991
replace fdi=fdi/1000
replace commitmentwb=commitmentwb/1000
replace commitmentsRDB=commitmentsRDB/1000
replace commitmentwb=commitmentwb/1000000
replace commitmentsRDB=commitmentsRDB/1000000
sum commitmentsRDB commitmentwb fdi
sum commitmentebrd
replace commitmentebrd=commitmentebrd/1000000000
sum commitmentebrd
xtset ccode year
*/Model 11/*
tobit usvote l1.rdbnew l1.ebrd l1.ibrd l2.cincofcountry c.l1.rdbnew#c.l2.cincofcountry c.l1.ebrd#c.l2.cincofcountry c.l1.ibrd#c.l2.cincofcountry i.year i.ccode, ul(1.0001) ll(-0.0001)
*/Model 12/*
tobit usvote l1.rdbnew l1.ebrd l1.ibrd l2.cincofcountry c.l1.rdbnew#c.l2.cincofcountry c.l1.ebrd#c.l2.cincofcountry c.l1.ibrd#c.l2.cincofcountry  l1.fdi l1.inverse_sum l1.openness l1.nucsecguarUS i.year i.ccode, ul(1.0001) ll(-0.0001)
clear
use "I:\ForISQ.dta", clear
*/ROBUSTNESS CHECKS WITH XTREG/*
*/Let's work with pooled data 1 - IADB and ASDB/*
keep if unsc_region==2 | unsc_region==5
*Model 1 - Only key variables: RDB Funding, CINC, and Interaction Term, with year and country fixed-effects/*
xtset ccode year
sum commitmentsRDB commitmentwb fdi
*We first place all values in the same scale: million USD current values/*e
replace fdi=fdi/1000
replace commitmentwb=commitmentwb/1000
replace commitmentsRDB=commitmentsRDB/1000
replace commitmentwb=commitmentwb/1000000
replace commitmentsRDB=commitmentsRDB/1000000
sum commitmentsRDB commitmentwb fdi
xtreg usvote l1.commitmentsRDB l1.commitmentwb l2.cincofcountry c.l1.commitmentsRDB#c.l2.cincofcountry c.l1.commitmentwb#c.l2.cincofcountry i.year i.ccode
xtreg usvote l1.commitmentsRDB l1.commitmentwb l2.cincofcountry c.l1.commitmentsRDB#c.l2.cincofcountry c.l1.commitmentwb#c.l2.cincofcountry l1.inverse_sum l1.openness l1.nucsecguarUS i.year i.ccode
*/Finish Model1 - Baseline - and Model 2 - With Controls - For IADB and ASDB/*
clear
use "C:\Users\User\Downloads\ForISQ.dta", clear
*/Let's work with pooled data 2 - IADB and ASDB and AFDB - after 1983/*
keep if year>=1983
drop if unsc_region==3
replace fdi=fdi/1000
replace commitmentwb=commitmentwb/1000
replace commitmentsRDB=commitmentsRDB/1000
replace commitmentwb=commitmentwb/1000000
replace commitmentsRDB=commitmentsRDB/1000000
sum commitmentsRDB commitmentwb fdi
drop if unsc_region==.
*/Model 5 - Only key variables: RDB Funding, CINC, and Interaction Term, with year and country fixed-effects/*
xtset ccode year
xtreg usvote l1.commitmentsRDB l1.commitmentwb l2.cincofcountry c.l1.commitmentsRDB#c.l2.cincofcountry c.l1.commitmentwb#c.l2.cincofcountry i.year i.ccode
*/Model 6/*
xtreg usvote l1.commitmentsRDB l1.commitmentwb l2.cincofcountry c.l1.commitmentsRDB#c.l2.cincofcountry c.l1.commitmentwb#c.l2.cincofcountry l1.fdi l1.inverse_sum l1.openness l1.nucsecguarUS i.year i.ccode
use "C:\Users\User\Downloads\ForISQ.dta", clear
*/Let's work with pooled data 3 - IADB and ASDB and AFDB and EBRD - after 1991/*
keep if year>=1991
replace fdi=fdi/1000
replace commitmentwb=commitmentwb/1000
replace commitmentsRDB=commitmentsRDB/1000
replace commitmentwb=commitmentwb/1000000
replace commitmentsRDB=commitmentsRDB/1000000
sum commitmentsRDB commitmentwb fdi
sum commitmentebrd
replace commitmentebrd=commitmentebrd/1000000000
sum commitmentebrd
*/Model 9 - Only key variables: RDB Funding, CINC, and Interaction Term, with year and country fixed-effects/*
xtset ccode year
xtreg usvote l1.commitmentsRDB l1.commitmentebrd l1.commitmentwb l2.cincofcountry c.l1.commitmentsRDB#c.l2.cincofcountry c.l1.commitmentebrd#c.l2.cincofcountry c.l1.commitmentwb#c.l2.cincofcountry l1.fdi l1.inverse_sum l1.openness l1.nucsecguarUS i.year i.ccode
*/Model 10 of table 3 was run too in the panel linear model/*
xtreg usvote l1.commitmentsRDB l1.commitmentebrd l1.commitmentwb l2.cincofcountry c.l1.commitmentsRDB#c.l2.cincofcountry c.l1.commitmentebrd#c.l2.cincofcountry c.l1.commitmentwb#c.l2.cincofcountry i.year i.ccode
clear
*/We now run robustness checks on membership/*
use "I:\ForISQ.dta", clear
*Let's work with pooled data 1 - IADB and ASDB/*
keep if unsc_region==2 | unsc_region==5
*Model 3 - Only key variables: RDB Funding, CINC, and Interaction Term, with year and country fixed-effects/*
xtset ccode year
sum commitmentsRDB commitmentwb fdi
*We first place all values in the same scale: million USD current values/*e
replace fdi=fdi/1000
replace commitmentwb=commitmentwb/1000
replace commitmentsRDB=commitmentsRDB/1000
replace commitmentwb=commitmentwb/1000000
replace commitmentsRDB=commitmentsRDB/1000000
sum commitmentsRDB commitmentwb fdi
xtreg usvote l1.rdbnew l1.ibrd l2.cincofcountry c.l1.rdbnew#c.l2.cincofcountry c.l1.ibrd#c.l2.cincofcountry i.year i.ccode
xtreg usvote l1.rdbnew l1.ibrd l2.cincofcountry c.l1.rdbnew#c.l2.cincofcountry c.l1.ibrd#c.l2.cincofcountry l1.inverse_sum l1.openness l1.nucsecguarUS i.year i.ccode
clear
use "C:\Users\User\Downloads\ForISQ.dta", clear
*Let's work with pooled data 2 - IADB and ASDB and AFDB - after 1983/*
keep if year>=1983
drop if unsc_region==3
replace fdi=fdi/1000
replace commitmentwb=commitmentwb/1000
replace commitmentsRDB=commitmentsRDB/1000
replace commitmentwb=commitmentwb/1000000
replace commitmentsRDB=commitmentsRDB/1000000
sum commitmentsRDB commitmentwb fdi
drop if unsc_region==.
*Model 7 - Only key variables: RDB Funding, CINC, and Interaction Term, with year and country fixed-effects/*
xtset ccode year
xtreg usvote l1.rdbnew l1.ibrd l2.cincofcountry c.l1.rdbnew#c.l2.cincofcountry c.l1.ibrd#c.l2.cincofcountry i.year i.ccode
xtreg usvote l1.rdbnew l1.ibrd l2.cincofcountry c.l1.rdbnew#c.l2.cincofcountry c.l1.ibrd#c.l2.cincofcountry l1.fdi l1.inverse_sum l1.openness l1.nucsecguarUS i.year i.ccode
clear
use "C:\Users\User\Downloads\ForISQ.dta", clear
*/Let's work with pooled data 3 - IADB and ASDB and AFDB and EBRD - after 1991/*
keep if year>=1991
replace fdi=fdi/1000
replace commitmentwb=commitmentwb/1000
replace commitmentsRDB=commitmentsRDB/1000
replace commitmentwb=commitmentwb/1000000
replace commitmentsRDB=commitmentsRDB/1000000
sum commitmentsRDB commitmentwb fdi
sum commitmentebrd
replace commitmentebrd=commitmentebrd/1000000000
sum commitmentebrd
xtset ccode year
xtreg usvote l1.rdbnew l1.ebrd l1.ibrd l2.cincofcountry c.l1.rdbnew#c.l2.cincofcountry c.l1.ebrd#c.l2.cincofcountry c.l1.ibrd#c.l2.cincofcountry i.year i.ccode
xtreg usvote l1.rdbnew l1.ebrd l1.ibrd l2.cincofcountry c.l1.rdbnew#c.l2.cincofcountry c.l1.ebrd#c.l2.cincofcountry c.l1.ibrd#c.l2.cincofcountry  l1.fdi l1.inverse_sum l1.openness l1.nucsecguarUS i.year i.ccode
clear
*/Let's now generate the graphs for figures 2 and 3/*
*/Graphs for figure 1 were elaborated in Excel. Data is available at "SupplementalFiles-RR.xlsx"/*
use "C:\Users\User\Downloads\ForISQ.dta", clear
*/Let's work with pooled data 1 - IADB and ASDB/*
keep if unsc_region==2 | unsc_region==5
*/Model 1 - Only key variables: RDB Funding, CINC, and Interaction Term, with year and country fixed-effects/*
xtset ccode year
sum commitmentsRDB commitmentwb fdi
*/We first place all values in the same scale: million USD current values/*e
replace fdi=fdi/1000
replace commitmentwb=commitmentwb/1000
replace commitmentsRDB=commitmentsRDB/1000
replace commitmentwb=commitmentwb/1000000
replace commitmentsRDB=commitmentsRDB/1000000
replace commitmentwb=commitmentwb/1000000
replace commitmentwb=commitmentwb*1000000
tobit usvote l1.commitmentsRDB l1.commitmentwb l2.cincofcountry c.l1.commitmentsRDB#c.l2.cincofcountry l1.inverse_sum l1.openness l1.nucsecguarUS i.year i.ccode, ul(1.0001) ll(-0.0001)
margins, at(l1.commitmentsRDB=(0 7.4) l2.cincofcountry=(0(0.1)0.2)) vsquish
marginsplot, noci x(l1.commitmentsRDB) recast(line) xlabel(0(1)7)
graph save Graph "I:\GraphA-Figure2.gph"
clear
use "C:\Users\User\Downloads\ForISQ.dta", clear
*/Let's work with pooled data 2 - IADB and ASDB and AFDB - after 1983/*
keep if year>=1983
drop if unsc_region==3
replace commitmentwb=commitmentwb/1000
replace commitmentsRDB=commitmentsRDB/1000
replace commitmentwb=commitmentwb/1000000
replace commitmentsRDB=commitmentsRDB/1000000
sum commitmentsRDB commitmentwb fdi
drop if unsc_region==.
xtset ccode year
tobit usvote l1.commitmentsRDB l1.commitmentwb l2.cincofcountry c.l1.commitmentsRDB#c.l2.cincofcountry l1.fdi l1.inverse_sum l1.openness l1.nucsecguarUS i.year i.ccode, ul(1.0001) ll(-0.0001)
margins, at(l1.commitmentsRDB=(0 7.4) l2.cincofcountry=(0(0.1)0.2)) vsquish
marginsplot, noci x(l1.commitmentsRDB) recast(line) xlabel(0(1)7)
graph save Graph "I:\GraphB-Figure2.gph"
clear
use "C:\Users\User\Downloads\ForISQ.dta", clear
*/let's now generate graphs for figure 3/*
*/Let's work with pooled data 3 - IADB and ASDB and AFDB and EBRD - after 1991/*
use "C:\Users\User\Downloads\ForISQ.dta", clear
keep if year>=1991
replace fdi=fdi/1000
replace commitmentwb=commitmentwb/1000
replace commitmentsRDB=commitmentsRDB/1000
replace commitmentwb=commitmentwb/1000000
replace commitmentsRDB=commitmentsRDB/1000000
sum commitmentsRDB commitmentwb fdi
sum commitmentebrd
replace commitmentebrd=commitmentebrd/1000000000
sum commitmentebrd
xtset ccode year
gen bm=l1.ibrd
gen europa=l1.ebrd
tobit usvote l1.rdbnew l1.ebrd bm l2.cincofcountry c.l1.rdbnew#c.l2.cincofcountry c.l1.ebrd#c.l2.cincofcountry c.bm#c.l2.cincofcountry  l1.fdi l1.inverse_sum l1.openness l1.nucsecguarUS i.year i.ccode, ul(1.0001) ll(-0.0001)
margins, at(l1.ebrd=(0 1)) over(bm) atmeans
marginsplot
graph save Graph "I:\Graph6-Europe.gph", replace
margins, at(l1.rdbnew=(0 1)) over(bm) atmeans
marginsplot
graph save Graph "I:\Graph6-RDBs.gph"
clear
log close
